package com.company.multidimensiontest;

import android.content.Context;
import android.opengl.GLSurfaceView;
import android.util.AttributeSet;
import android.view.MotionEvent;

public class ClearSurfacceView extends GLSurfaceView {
    
    private ClearRenderer mRenderer;
    
    public ClearSurfacceView(Context context) {
        super(context);
        mRenderer = new ClearRenderer();
        setRenderer(mRenderer);
    }
    
    public ClearSurfacceView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mRenderer = new ClearRenderer();
        setRenderer(mRenderer);
    }        
    
    @Override
    public boolean onTouchEvent(final MotionEvent event) {
        queueEvent(new Runnable() {            
            @Override
            public void run() {
                mRenderer.setColor(event.getX() / getWidth(), event.getY() / getHeight(), 1.0f);
            }
        });
        return true;
    }

}
